var neirong =window.location.search.split("=")[1];
$.ajax({
    type: "get",
    url: "../php/like.php",
    data: {"neirong":decodeURIComponent(neirong)},
    dataType: "json",
    success: function (list) {
        var html=""
        $.each(list,function(i,n){
            var id=n.id;
            var smallimg=n.smallimg;
            var goodsname=n.goodsname;
            var price=n.price;
            html+=`
                <li class="goodsLi" data-id=${id}>
                    <img src="../images/${smallimg}" alt="">
                    <p>${goodsname}</p>
                    <div><span class="iconfont icon-qian">${price}</span></div>
                </li>
            `  
        })
       
        $(".goodsbox").append(html);
    }
});

//购物车计数
var usertel=getCookie("logintel");
showNum();
function showNum(){
    if(usertel){
        $.ajax({
            type: "get",
            url: "../php/num.php",
            data: {"usertel":usertel},
            dataType: "json",
            success: function (item) {
                if(item[0]>0){
                    $("#shoppingcar").html(item[0]);
                    $("#shoppingcar").css("display","block");
                }
            }
        });
    }
}

$(".icon-tubiaolunkuo-").click(function(){
    window.location.href="../html/shopping.html";
})
//登录以后小人里面放用户电话号码
$(".icon-gerenxinxi").hover(
    function(){
        if(getCookie("logintel")){
            $(".xinxiboxLi").html(getCookie("logintel"))
        }
    }
)

